package test3

import "fmt"

type T int

func (t T) Error() string {
	return "bad error"
}

func Test5() {
	var err1 error
	var err2 error
	//  T指针类型，data指针指向的内存值为 nil
	err1 = (*T)(nil)
	println("err1", err1)
	println("err1 = nil", err1 == nil)

	err1 = T(5)
	err2 = T(6)
	println("err1", err1)
	println("err2", err2)
	println("err1 = err2", err2 == err1)
	// 必须动态类型和其data指针指向值相同，才会对等
	err2 = fmt.Errorf("%d\n", 5)
	println("err1", err1)
	println("err2", err2)
	println("err1 = err2", err2 == err1)
}
